<!-- 地球物理测线-线 -->
<template>
  <el-drawer v-model="addDrawer" size="45%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
    <template #title>
      <el-space direction="vertical" class="space-width100">
        <div v-if="route.path.includes('dataIntegrate') && form.qcOpinion">
          <el-form :model="form" :inline="true" label-width="140px">
            <el-form-item label="质检不通过原因" style="width: 100%">
              <el-input v-model="form.qcOpinion" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" resize="none"
                clearable></el-input>
            </el-form-item>
          </el-form>
        </div>
        <h2>
          <el-row justify="space-between">
            <span><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></span>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading"
              v-if="isShowSave">保存</el-button>
          </el-row>
        </h2>
      </el-space>
    </template>
    <template #default>
      <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="140px" v-loading="drawerLoading">
        <el-row justify="space-between">
          <el-form-item label="省">
            <el-input v-model="form.province" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="市">
            <el-input v-model="form.city" clearable disabled></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="区/县">
            <el-input v-model="form.county" clearable disabled></el-input>
          </el-form-item>
          <el-form-item label="测线编号" prop="id">
            <el-input v-model="form.id" placeholder="请输入测线编号" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线所属探测工程编号" prop="projectId">
            <el-input v-model="form.projectId" placeholder="请输入测线所属探测工程编号" clearable maxlength="17"></el-input>
          </el-form-item>
          <el-form-item label="测线代码" prop="fieldId">
            <el-input v-model="form.fieldId" placeholder="请输入测线代码" clearable maxlength="17"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线名称" prop="name" style="width: 100%">
            <el-input v-model="form.name" placeholder="请输入测线名称" clearable :autosize="{ minRows: 2, maxRows: 4 }"
              type="textarea" show-word-limit maxlength="50" resize="none"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线来源与类型" prop="svyLineSource">
            <dict-select :code="checkDict('svyLineSource', 'L5')" :value="form.svyLineSource" @update="updateDict('svyLineSource', $event)"></dict-select>
            <!-- <dict-select code="GeophySvyMethod" :value="form.svyLineSource" @update="updateDict('svyLineSource', $event)"></dict-select> -->
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="收集地球物理测线来源补充说明来源" prop="collectedLineSource" style="width: 100%">
            <el-input v-model="form.collectedLineSource" placeholder="请输入收集地球物理测线来源补充说明来源"
              :autosize="{ minRows: 4, maxRows: 8 }" type="textarea" show-word-limit maxlength="255" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探测目的" prop="purpose" style="width: 100%">
            <el-input v-model="form.purpose" placeholder="请输入探测目的" :autosize="{ minRows: 4, maxRows: 8 }" type="textarea"
              show-word-limit maxlength="255" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="探测方法" prop="svyMethod">
            <dict-select code="GeophySvyMethod-CVD" :value="form.svyMethod" @update="updateDict('svyMethod', $event)"></dict-select>
          </el-form-item>
          <el-form-item label="起点桩号" prop="startMilestoneNum">
            <el-input v-model="form.startMilestoneNum" placeholder="请输入起点桩号" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="终点桩号" prop="endMilestoneNum">
            <el-input v-model="form.endMilestoneNum" placeholder="请输入终点桩号" clearable maxlength="4"></el-input>
          </el-form-item>
          <el-form-item label="测线长度 [米]" prop="length">
            <el-input v-model="form.length" placeholder="请输入测线长度 [米]" clearable maxlength="8"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="综合解释剖面名称" prop="resultName" style="width:100%">
            <el-input v-model="form.resultName" placeholder="请输入综合解释剖面名称" :autosize="{ minRows: 4, maxRows: 8 }"
              type="textarea" show-word-limit maxlength="200" clearable></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="综合解释剖面原始数据文件编号（sgy等）" prop="expDataArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.expDataArwid" placeholder="请输入综合解释剖面原始数据文件编号（sgy等）" clearable
                maxlength="20"></el-input>
            </el-space>
          </el-form-item>
          <el-form-item label=" " prop="expDataArwidId" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <FileUpload v-model="form.expDataArwidName" @uploadFile="uploadSuccess('expDataArwid', $event)"
                @delFile="deleteFile('expDataArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="综合解释剖面矢量图原始文件编号" prop="resultMapArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.resultMapArwid" placeholder="请输入综合解释剖面矢量图原始文件编号" clearable
                maxlength="20"></el-input>
            </el-space>
          </el-form-item>
          <el-form-item label=" " prop="resultMapArwidId" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <FileUpload v-model="form.resultMapArwidName" @uploadFile="uploadSuccess('resultMapArwid', $event)"
                @delFile="deleteFile('resultMapArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="综合解释剖面栅格图原始文件编号" prop="resultMapAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.resultMapAiid" placeholder="请输入综合解释剖面栅格图原始文件编号" clearable maxlength="20"></el-input>
            </el-space>
          </el-form-item>
          <el-form-item label=" " prop="resultMapAiidId" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <ImageUpload v-model="form.resultMapAiidName" @uploadImage="uploadSuccess('resultMapAiid', $event)"
                @delFile="deleteFile('resultMapAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断点解释剖面图图像编号" prop="faultPtProfileAiid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.faultPtProfileAiid" placeholder="请输入断点解释剖面图图像编号" clearable
                maxlength="20"></el-input>
              <ImageUpload v-model="form.faultPtProfileAiidName"
                @uploadImage="uploadSuccess('faultPtProfileAiid', $event)"
                @delFile="deleteFile('faultPtProfileAiid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="断点解释剖面图原始文件编号" prop="faultPtProfileArwid" style="width:100%">
            <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
              <el-input v-model="form.faultPtProfileArwid" placeholder="请输入断点解释剖面图原始文件编号" clearable
                maxlength="20"></el-input>
              <FileUpload v-model="form.faultPtProfileArwidName"
                @uploadFile="uploadSuccess('faultPtProfileArwid', $event)"
                @delFile="deleteFile('faultPtProfileArwid', $event)" />
            </el-space>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="显示码（制图用）" prop="showCode">
            <el-input v-model="form.showCode" placeholder="请输入显示码（制图用）" clearable maxlength="4"></el-input>
          </el-form-item>
        </el-row>
        <el-row justify="space-between">
          <el-form-item label="测线备注" prop="commentInfo" style="width:100%">
            <el-input v-model="form.commentInfo" placeholder="请输入测线备注" :autosize="{ minRows: 6, maxRows: 12 }"
              type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
          </el-form-item>
        </el-row>
      </el-form>
    </template>
  </el-drawer>
</template>
<script setup>
import useSpatialData from '@/hooks/useSpatialData'
import { eightDouble, fourInt } from '@/utils/validate'
import { checkDict } from '@/views/businessManage/common/dict'
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, uploadSuccess, deleteFile, updateDict, isShowSave } = useSpatialData()

const formRules = {
  id: [{ required: true, message: '请填写测线编号！', trigger: 'blur' }],
  projectId: [{ required: true, message: '请填写测线所属探测工程编号！', trigger: 'blur' }],
  fieldId: [{ required: true, message: '请填写测线代码！', trigger: 'blur' }],
  name: [{ required: true, message: '请填写测线名称！', trigger: 'blur' }],
  svyLineSource: [{ required: true, message: '请填写测线来源与类型！', trigger: 'blur' }],
  svyMethod: [{ required: true, message: '请选择探测方法！', trigger: 'change' }],
  startMilestoneNum: [fourInt],
  endMilestoneNum: [eightDouble],
  length: [eightDouble],
  expDataArwid: [{ required: true, message: '请填写综合解释剖面原始数据文件编号（sgy等）！', trigger: 'blur' }],
  expDataArwidId: [{ required: true, message: '请上传综合解释剖面原始数据文件编号（sgy等）附件！', trigger: 'blur' }],
  resultMapArwid: [{ required: true, message: '请填写综合解释剖面矢量图原始文件编号！', trigger: 'blur' }],
  resultMapArwidId: [{ required: true, message: '请上传综合解释剖面矢量图原始文件编号附件！', trigger: 'blur' }],
  resultMapAiid: [{ required: true, message: '请填写综合解释剖面栅格图原始文件编号！', trigger: 'blur' }],
  resultMapAiidId: [{ required: true, message: '请上传综合解释剖面栅格图原始文件编号图片！', trigger: 'blur' }],
  showCode: [fourInt]
}
</script>